package com.hd.crdao.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.MyApplication;
import com.hd.crdao.base.MyBaseAdapter;
import com.hd.crdao.bean.ToDayDetailsBean;

import java.util.List;

/**
 *
 *@author Administrator
 *@date 2017/8/18 0018
 */

public class AccountDetailsAdapter extends MyBaseAdapter<ToDayDetailsBean.ReceiListTodayBean> {
    public AccountDetailsAdapter(List<ToDayDetailsBean.ReceiListTodayBean> dataSets) {
        super(dataSets);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
       ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = View.inflate(MyApplication.getContext(), R.layout.item_account_details, null);
            //找到控件
            holder.mPurpose = (TextView) convertView.findViewById(R.id.purpose);
            holder.mTime = (TextView) convertView.findViewById(R.id.time);
            holder.mPrice = (TextView) convertView.findViewById(R.id.price);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        ToDayDetailsBean.ReceiListTodayBean receiListTodayBean = mDataSets.get(position);

        //设置数据
        holder.mPurpose.setText(receiListTodayBean.getProduct().getPrName());
        holder.mTime.setText(receiListTodayBean.getRlResTimeEnd());
        holder.mPrice.setText("+"+receiListTodayBean.getRlAmount());


        return convertView;
    }

    class ViewHolder {
        TextView mPurpose;
        TextView mTime;
        TextView mPrice;
    }
}
